<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    request.setCharacterEncoding("UTF-8");
    String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>模版管理</title>
    <jsp:include page="../../../head.jsp"/>
    <style type="text/css">
        .td_right {
            text-align: right;
        }
    </style>
    <script>
        $(function () {
            //初始化表单验证引擎
            $("#demoForm").validationEngine("attach", {
                //消息位置
                promptPosition: "bottomRight",
                scroll: false
            });
            //初始化ajaxForm参数
            var options = {
                //提交方式
                type: "POST",
                //提交数据格式
                dataType: "json",
                //在提交之前做的操作
                beforeSubmit: function () {
                    return $("#demoForm").validationEngine("validate");
                },
                //成功后做的操作
                success: function (responseText, statusText, xhr, $form) {
                    alert(responseText.msg);
                    location.reload(true);
                }
            };
            $('#demoForm').ajaxForm(options);
        });
        function submitTheForm() {
            $("#demoForm").submit();
        }

    </script>
</head>
<body>
<%=htmlData%>
<form action="demo-save" method="post" id="demoForm">
    <div class="ui-widget">
        <table class="ui-widget-content">
            <tr>
                <td class="td_right">模版名称</td>
                <td><input class="validate[required]" type="text" id="demo_name" name="demo.name"
                           value='<s:property value="demo.name"/>' style="width: 150px;"/>*
                </td>
            </tr>
            <tr>
                <td class="td_right">模版内容</td>
                <td><textarea rows="6" cols="60" class="validate[required]" id="demo_content"
                              name="demo.contents"><s:property value="demo.contents"/></textarea>*
                </td>
            </tr>
        </table>
    </div>
    <input type="hidden" name="demo.id" id="demo_id" value='<s:property value="demo.id"/>'/>
    <input type="hidden" name="demo.typeId" value='<s:property value="demo.typeId"/>'/>
    <input type="hidden" name="demo.nodeId" value='<s:property value="demo.nodeId"/>'/>
    <input type="button" value="保存" onclick="submitTheForm();"/>
    <!-- <input type="button" value="返回" onclick="javascript:history.back();"/> -->
</form>
</body>
</html>
